package com.asus.api;

import java.util.HashMap;
import java.util.Map.Entry;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

public class AsusApiActivity extends Activity
{
	/** Called when the activity is first created. */

	LinearLayout mLayout;

	@Override
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		mLayout = (LinearLayout) this.findViewById(R.id.mylayout);

		TextView _TextView = new TextView(this);
		_TextView.setText("Hello");
		mLayout.addView(_TextView);

		HashMap<String, String> _Params = new HashMap<String, String>();
		HashMap<String, String> _Params2 = new HashMap<String, String>();
		HashMap<String, String> _Params3 = new HashMap<String, String>();

		_Params.put("LoginID", "asussqgg@gmail.com");
		_Params.put("Password", "asustest");

		LoginApi _Api = new LoginApi(_Params);
		_Api.Start();

		_Params2.put("First_name", "HAHA");
		_Params2.put("Last_name", "HAHA");
		_Params2.put("Birthdate", "2011/1/1");
		_Params2.put("Country", "TWN");
		_Params2.put("City", "TAIPEI");
		_Params2.put("Receive", "0");
		_Params2.put("Addr1", "");
		_Params2.put("Phone", "");
		_Params2.put("NickName", "");
		_Params2.put("Gender", "");
		_Params2.put("State", "");
		_Params2.put("Education", "ID-M007-11");
		_Params2.put("Professional", "ID-M007-12");
		_Params2.put("Zipcode", "");

		UpdateRegApi _Api2 = new UpdateRegApi(_Params2);

		if (_Api2.Start())
		{
			Log.i("Macalog", "Success!");
			
			for (Entry<String, String> _Set :_Api2.getHashMap().entrySet())
			{
				Log.i("Macalog", _Set.getKey() +"  "+ _Set.getValue());			
			}
		}
		
		_Params3.put("LoginID", "HAHA9527");
		_Params3.put("Password", "HAHA1234");
		
		_Params3.put("First_name", "How");
		_Params3.put("Last_name", "Lu");		
		_Params3.put("Birthdate", "2011/1/1");
		_Params3.put("Country", "TWN");
		_Params3.put("City", "TAIPEI");
		_Params3.put("Receive", "0");
		_Params3.put("Receive", "app_coevo");
		_Params3.put("Addr1", "");
		_Params3.put("Phone", "");
		_Params3.put("NickName", "");
		_Params3.put("Gender", "");
		_Params3.put("State", "");
		_Params3.put("Education", "ID-M007-11");
		_Params3.put("Professional", "ID-M007-12");
		_Params3.put("Zipcode", "");
		
		CreRegApi _Api3 = new CreRegApi(_Params3);	
		
		if (_Api3.Start())
		{
			Log.i("Macalog", "Success!");
			
			for (Entry<String, String> _Set :_Api3.getHashMap().entrySet())
			{
				Log.i("Macalog", _Set.getKey() +"  "+ _Set.getValue());			
			}
		}

		Button _Button = (Button) this.findViewById(R.id.button1);

		_Button.setOnClickListener(new OnClickListener()
		{

			public void onClick(View v)
			{
				connect();
			}
		});

	}

	private void connect()
	{

	}
}